<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>27_关于this指向的面试题</title>
</head>

<body>
    <script>
        var name = 'Global';
        var obj = {
            name: 'Object',
            sayName: function () {
                console.log(this.name);
            },
            innerObj: {
                name: 'Inner Object',
                sayNameAgain: function () {
                    var innerFunction = function () {
                        console.log(this.name);
                    };
                    innerFunction();
                }
            }
        };

        obj.sayName(); // Object
        obj.innerObj.sayNameAgain(); //
    </script>
</body>

</html>